package com.yanxinim.cn.store;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.makeramen.roundedimageview.RoundedImageView;
import com.yanxinim.cn.R;
import com.yanxinim.cn.bean.User;
import com.yanxinim.cn.helper.AvatarHelper;
import com.yanxinim.cn.ui.base.BaseActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class StoreMineActivity extends BaseActivity {
    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.rl_title)
    RelativeLayout rlTitle;
    @BindView(R.id.riv_avatar)
    RoundedImageView rivAvatar;
    @BindView(R.id.tv_user_name)
    TextView tvUserName;
    @BindView(R.id.ll_order1)
    LinearLayout llOrder1;
    @BindView(R.id.ll_order2)
    LinearLayout llOrder2;
    @BindView(R.id.ll_order3)
    LinearLayout llOrder3;
    @BindView(R.id.ll_order4)
    LinearLayout llOrder4;
    @BindView(R.id.ll_address)
    LinearLayout llAddress;
    @BindView(R.id.ll_message)
    LinearLayout llMessage;
    User user;
    @BindView(R.id.tv_user_phone)
    TextView tvUserPhone;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.a_store_mine_activity);
        ButterKnife.bind(this);
        user = getUser();
        tvUserName.setText(user.getNickName());
        tvUserPhone.setText(user.getTelephone());

        AvatarHelper.getInstance().displayAvatar(coreManager.getSelf().getUserId(), rivAvatar, true);
    }

    @OnClick({R.id.iv_back, R.id.ll_order1, R.id.ll_order2, R.id.ll_order3, R.id.ll_order4, R.id.ll_address, R.id.ll_message})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                finish();
                break;
            case R.id.ll_order1:
            case R.id.ll_order2:
            case R.id.ll_order3:
            case R.id.ll_order4:
                startActivity(new Intent(StoreMineActivity.this, StoreOrderListActivity.class));
                break;
            case R.id.ll_address:
                startActivity(new Intent(StoreMineActivity.this, StoreUserAddressActivity.class));
                break;
            case R.id.ll_message:
                break;
        }
    }
}
